package com.julius.design.pattern.filter;

import java.util.List;

/**
 * <p>
 *      and 条件
 * </p>
 */
public class AndFilter implements Filter {


    private final Filter filter;

    private final Filter otherFilter;



    public AndFilter(Filter filter,Filter otherFilter) {
        this.filter = filter;
        this.otherFilter = otherFilter;
    }


    @Override
    public List<Person> filter(List<Person> personList) {
        List<Person> filter = this.filter.filter(personList);
        return this.otherFilter.filter(filter);
    }
}
